#include <stdio.h>
#include "slist.h"
#include <string.h>
#include <stdlib.h>

void my_printf(void *data)
{
    printf("%d ", *((int *)data));

    return;
}

int main(int argc, char **argv)
{
    slist_t *s = NULL;
    int num = 0;

    slist_create(&s, sizeof(int), my_destroy);

    while (1)
    {
    op:
        my_scanf(op, "%d", &num);

        if (-1 == num)
        {
            break;
        }

        // slist_append(s, &num);
        slist_prepend(s, &num);
    }

    // 遍历
    slist_traverse(s, my_printf);

    // 检索插入
    slist_insert_by_index(s, 66, 3);

    // 遍历
    slist_traverse(s, my_printf);

    // 销毁
    s->my_destroy(s);






    return 0;
}